package com.mall.business.service;

import java.util.List;
import com.mall.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mall.business.mapper.BusExpressCompanyMapper;
import com.mall.business.domain.entity.BusExpressCompany;
import com.mall.common.core.text.Convert;

/**
 * 快递公司Service业务层处理
 *
 * @author zhonglin
 * @date 2020-05-24
 */
@Service
public class BusExpressCompanyService {

  @Autowired
  private BusExpressCompanyMapper busExpressCompanyMapper;

  /**
   * 查询快递公司
   *
   * @param expressCompanyId 快递公司ID
   *
   * @return 快递公司
   */
  public BusExpressCompany selectBusExpressCompanyById(Long expressCompanyId) {

    return busExpressCompanyMapper.selectBusExpressCompanyById(expressCompanyId);
  }

  /**
   * 查询快递公司列表
   *
   * @param busExpressCompany 快递公司
   *
   * @return 快递公司
   */
  public List<BusExpressCompany> selectBusExpressCompanyList(BusExpressCompany busExpressCompany) {

    return busExpressCompanyMapper.selectBusExpressCompanyList(busExpressCompany);
  }

  /**
   * 新增快递公司
   *
   * @param busExpressCompany 快递公司
   *
   * @return 结果
   */
  public int insertBusExpressCompany(BusExpressCompany busExpressCompany) {

    busExpressCompany.setCreateTime(DateUtils.getNowDate());
    return busExpressCompanyMapper.insertBusExpressCompany(busExpressCompany);
  }

  /**
   * 修改快递公司
   *
   * @param busExpressCompany 快递公司
   *
   * @return 结果
   */
  public int updateBusExpressCompany(BusExpressCompany busExpressCompany) {

    busExpressCompany.setUpdateTime(DateUtils.getNowDate());
    return busExpressCompanyMapper.updateBusExpressCompany(busExpressCompany);
  }

  /**
   * 删除快递公司对象
   *
   * @param ids 需要删除的数据ID
   *
   * @return 结果
   */
  public int deleteBusExpressCompanyByIds(String ids) {

    return busExpressCompanyMapper.deleteBusExpressCompanyByIds(Convert.toStrArray(ids));
  }

  /**
   * 删除快递公司信息
   *
   * @param expressCompanyId 快递公司ID
   *
   * @return 结果
   */
  public int deleteBusExpressCompanyById(Long expressCompanyId) {

    return busExpressCompanyMapper.deleteBusExpressCompanyById(expressCompanyId);
  }

}
